<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>燃气管道安装搜索页</title>
		<link rel="stylesheet" type="text/css" href="css/common.css" />
		<link rel="stylesheet" type="text/css" href="css/search.css" />
		<script src="jQuery/jquery.js"></script>
		<script src="js/common.js"></script>
		<script type="text/javascript">
			$(function() {
				//清除搜索文本框事件
				$(".cancel-txt").click(function() {
					$("input").val('');
				});

				//搜索按钮点击事件
				$('.search-icon').click(function() {
					$.ajax({
						type: "post",
						url: "http://192.30.255.102:80/Gas/fuzzyBuildArea",
						async: true,
						data: {
							areaName: $(".search-com").val()
						},
						dataType: "json",
						success: function(datamsg) {
							if(datamsg.code == 1) {
								var arr = new Array();
								arr = datamsg.data;
								var str = new Array();
								for(var i = 0; i < arr.length; i++) {
									str += "<li id=" + i + ">" + arr[i].trim() + "</li>";
								}
								$(".rq-address").html(str);
								for(var i = 0; i < arr.length; i++) {
									liClick(i);
								}
							} else if(datamsg.code == -1) {
								console.log(111)
							}
						}
					});
				});
				
				//点击地址列表事件
				function liClick(i) {
					$("#" + i).click(function() {						
						var listr = $("#" + i).text();
						$(".p-address").append(listr);
					});
				}
				
				
				/*function build2addr(addr, code, characteristic, isContinueNumber) { //addr:楼幢地址（fuzzyBuild接口返回的addr）, code:楼幢编码，characteristic:楼幢特征码, isContinueNumber:是否连号
					$.post("/TransferSystem/query/address", {
						buildCode: code
					}, function(value) {
						var build = [];
						gRooms = [];
						if(bs === "new_install") {
							if(characteristic && characteristic.length > 1) {
								var floorCount = characteristic.charCodeAt(0) - 48; //多少层
								var unitCount = characteristic.length - 1; //单元数

								for(var i = 1; i <= floorCount; i++) {
									var iString = "" + i;
									while(iString.length < 2) {
										iString = "0" + iString; //2位楼层
									}
									build[i] = [];
									gRooms[i] = [];

									var continueNumber = 0;

									for(var j = 1; j <= unitCount; j++) {
										var jString = "" + j;
										while(jString.length < 3) {
											jString = "0" + jString; //3位单位
										}
										build[i][j] = [];
										var roomCount = characteristic.charCodeAt(j) - 48;

										for(var k = 1; k <= roomCount; k++) {
											var kString = "" + k;
											var kCode = "" + k;
											if(isContinueNumber) {
												continueNumber++;
												kString = "" + continueNumber;
											}
											while(kString.length < 2) {
												kString = "0" + kString;
											}
											while(kCode.length < 2) {
												kCode = "0" + kCode; //2位房室号
											}
											build[i][j][k] = {};
											build[i][j][k].addr = addr + j + "单元" + i + kString + "室";
											build[i][j][k].addrCode = code + jString + iString + kCode + "0";
											build[i][j][k].new = true;
											for(var l = 0; l < value.length; l++) {
												var eFloor = parseInt(value[l].addrCode.trim().substr(16, 2));
												var eUnit = parseInt(value[l].addrCode.trim().substr(13, 3));
												var eRoom = parseInt(value[l].addrCode.trim().substr(18, 2));
												if(i == eFloor && j == eUnit && k == eRoom) {
													build[i][j][k].new = false;
													break;
												}
											}
											if(build[i][j][k].new)
												gRooms[i].push(build[i][j][k]);
										}
									}
								}
							}
						} else {
							if(value && value.length) {
								gRooms = value;
							} else {
								gRooms = [];
							}
						}
					});
				}*/

			});
		</script>
	</head>

	<body>
		<div class="rq-container">
			<div class="search-wp">
				<!--<img src="img/search-white.svg" class="search-icon" onclick="window.location.href = 'rqgdazsq.html'" />-->
				<img src="img/search-white.svg" class="search-icon" />
				<input type="text" class="search-com" placeholder="请输入街道或小区名称" />
				<i class="iconfont cancel-txt">&#xe635;</i>
				<div class="bg-green"></div>
			</div>
			<p class="p-address">您选择的地址为：</p>
			<ul class="rq-address">
				<!--<li>安吉路</li>
				<li>宝石路</li>
				<li>宝石二路</li>-->
			</ul>
		</div>
	</body>

</html>